<%--
  Created by IntelliJ IDEA.
  User: ykj
  Date: 16/4/4
  Time: 下午2:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<script>
    $(document).ready(function(){
        $('.pageLink').click(function(){
            var page = $(this).attr('page');
            $('#info-content').load('allPurchases?page='+page);
        });
    });
</script>
<div>
    <table class="table table-striped purchase-table">
        <thead>
        <tr>
            <th>#</th>
            <th>产品</th>
            <th>年化收益率</th>
            <th>投资金额(元)</th>
            <th>起息时间</th>
            <th>到期时间</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach var="purchase" items="${purchases.list}" varStatus="status">
            <tr>
                <th scope="row">${status.count}</th>
                <td><a href="../product/detail?id=${purchase.productId}" class="product-link">${purchase.productName}</a></td>
                <td>${purchase.rateReturn}%</td>
                <td>${purchase.invest}元</td>
                <td><fmt:formatDate value="${purchase.createTime}" pattern="yyyy-MM-dd"/></td>
                <td><fmt:formatDate value="${purchase.expireDate}" pattern="yyyy-MM-dd"/></td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div class="text-center">
        <ul class="pagination">
            <li><a href="#">&laquo;</a></li>
            <c:forEach begin="1" end="${purchases.totalPage}" varStatus="status">
                <li><a class="pageLink" page="${status.index}" href="javascript:void(0);">${status.index}</a></li>
            </c:forEach>
            <li><a href="#">&raquo;</a></li>
        </ul>
    </div>
</div>